import Vue from "vue";
import {request} from "../../../util/request.js";
import "../../../style/basic.less";
import dialog from "../../../util/dialog.js";
new Vue({
    el:"#louie",
    data:{
        map_key:""
    },
    computed:{
        data:function(){
            return {
                map_key:this.map_key
            }
        }
    },
    created:function(){
        this.get();
    },
    methods:{
        /**
         * 获取参数
         */
        get(){
            request("setting/easyFind",{
                return:["map_key"]
            })
                .then((res)=>{
                    if(res.data.status === "success"){
                        let data = res.data.data;
                        this.map_key = data.map_key;
                    }
                });
        },
        /**
         * 设置参数
         */
        submit(){
            request("setting/set",{
                data:this.data
            })
                .then((res)=>{
                    if(res.data.status === "success"){
                        dialog.alert(this,"设置成功");
                    }else{
                        dialog.alert(this,"设置失败");
                    }
                });
        }
    }
});